﻿using System.Media;

namespace ClockLib.Audio
{
    public class WAVPlayer
    {
        private SoundPlayer player;

        public WAVPlayer()
        {
            player = new SoundPlayer();
        }

        public void Play(string audioPath, int repeatTime=1)
        {
            player.SoundLocation = audioPath;
            for (int i = 0; i < repeatTime; i++)
            {
                player.PlaySync();
                i++;
            }
        }

        public static void QuickPlay(string audioPath, int repeatTime=1)
        {
            //Console.WriteLine($"Quick Play:\n{audioPath}\n{repeatTime}");
            var player= new SoundPlayer(audioPath);
            for (int i = 0; i < repeatTime; i++)
            {
                player.PlaySync();
            }
        }
    }
}
